﻿using System.Web.Script.Serialization;
using System.IO;

namespace Utility
{
    public static class JsonSerializer
    {
        public static void SerializeToFile<T>(T target, string path)
        {
            File.WriteAllText(path, new JavaScriptSerializer().Serialize(target));
        }

        public static T DeserializeFromFile<T>(string path)
        {
            return new JavaScriptSerializer().Deserialize<T>(File.ReadAllText(path));
        }
    }
}
